Skip to main content

ComponentTests

Vertical Stacked Bar Chart – Component test plan

Sub-components: Bar, Line, Legends, Callout, Labels

  1. Bar: Bar data, Bar color (single/multiple), bar label
  2. Line: show/hide line, highlight data points on line and show callout
  3. Legends: show/hide legends, highlight the corresponding bar/line on legend hover
  4. Callout: Default/custom callout
  5. Labels: x-Axis labels default/rotated
Test stepsValidationTool used
Test 1: [Snapshot testing]
- With only data prop, numerical data on x-axis.Renders VerticalStackedBar chart correctlyRTL
- With only data prop, numerical data on x-axis and RTL modeShould render the vertical stacked bar chart with numeric x-axis in RTL modeRTL
- With HideLegend prop set to “true”Should hide legendsEnzyme
- With HideTooltip prop set to “true”Should hide the tooltip in chartEnzyme
- With EnabledLegendsWrapLines set to “true”Should enable the legends to wrap lines if there is not enough space to show all legends on a single lineEnzyme
- With ShowXAxisLablesTooltip set to “true”Should truncate x axis labels and show tooltip on x axis labelsEnzyme
- With WrapXAxisLables set to “true”Should wrap x axis label valuesEnzyme
- With isCalloutForStack set to “true”Should render callout for stack properlyEnzyme
- With yAxisTickFormat set to “%d”

Should render the y-axis ticks in the format specified

Enzyme
- With hideLabels set to “true”Should hide bar labelsEnzyme
Test 2: Basic props testing
- HideLegend prop set to “true”Should not mount legend when hideLegend is trueEnzyme
- HideLegend prop set to “false”Should mount legend when hideLegend is falseEnzyme
- HideTooltip prop set to “true”Should not mount callout when hideTootip is trueEnzyme
- HideTooltip prop set to “false”Should mount callout when hideTootip is falseEnzyme
- onRenderCalloutPerStack prop is not givenShould not render onRenderCalloutPerStackEnzyme
- onRenderCalloutPerDataPoint is givenShould render onRenderCalloutPerDataPointEnzyme
- onRenderCalloutPerDataPoint is not givenShould not render onRenderCalloutPerDataPointEnzyme
- onRenderCalloutPerDataPoint is givenShould render onRenderCalloutPerDataPointEnzyme
Test 3: Render calling with respective to props
- No prop changes: Mount VerticalStackedBar chart and then set the same props againRender function should have been called twiceEnzyme
- Prop changes: Mount VerticalStackedBar chart and then set some other propRender function should have been called twiceEnzyme
Test 4: Mouse events
- Mouse over on a barShould render callout correctly on mouseoverEnzyme
- Mouse move from one bar to other barShould render callout correctly on mouse moveEnzyme
- Mouse over on a bar with customized calloutShould render customized callout on mouseoverEnzyme
- Customized callout per stack on mouse overShould render customized callout per stack correctly on mouseoverEnzyme
- Customized callout on a bar from one bar to other barShould render customized callout for stack on mouseoverEnzyme
Test 5: [Sub-Component]: Line
- Specify line dataShould render line with the data providedRTL
Test 6: [Sub-Component]: Bar
- Specify bar colorShould render bar with the specified colorRTL
- Specify separate bars in a single barShould render stacked bar with specified dataRTL
- setMinimumBarHeight to “x”Should render bars properly, bars below this height will be displayed at this heightRTL
- set barWidth to “x”Should render bars with specified bar widthRTL
- set barGapMax to “x”Should render bars with specified bar gapRTL
- set barCornerRadiusShould render top bar with specified bar corner radiusRTL
Test 7: [Sub-Component]: Legends
- Hide legendsShould not show any rendered legendsRTL
- Hover mouse over line legendsShould reduce the opacity of the other lines/barsRTL
- Hover mouse over bar legendsShould reduce the opacity of the other lines/barsRTL
- Mouse move from one Legend to another LegendShould reset the opacity of the lines on mouse leave a bar legendRTL
- Single mouse click on bar legendsShould select legend on single mouse click on respective legendRTL
- Double mouse click on bar legendsShould deselect legend on double mouse click on respective legendRTL
- Single mouse click on line legendsShould select legend on single mouse click on respective legendRTL
- Double mouse click on line legendsShould deselect legend on double mouse click on respective legendRTL
- Mouse leave from bar legendShould call the handler on mouse leave from bar legendRTL
- Mouse leave from line legendShould call the handler on mouse leave from line legendRTL
- Mouse over on bar legendShould call the handler mouse over on legendRTL
- Mouse click on legendShould call the handler mouse click on legendRTL
Test 8: [Sub-Component]: Callout
- Hover mouse over a barShould call the handler on mouse over barRTL
- Hover mouse over a bar to display calloutShould show the default callout over that barRTL
- Hover mouse over a stacked barShould show the default stacked call outRTL
- Hover mouse over the lineShould show the default callout over that lineRTL
- Specify custom callout and hover mouse over a barShould show the custom callout over that barRTL
- Specify custom callout and hover mouse over the lineShould show the custom callout over that lineRTL
- Mouse click on barShould call the handler on mouse click on the barRTL
Test 9: [Sub-Component]: x-axis labels
- Truncate x-axis labelsShould show the x-axis labels tooltip when hoveredRTL
- Rotate x-axis labelsShould rotate the x-axis labels by 45 degreesRTL
Test 10: [Sub-Component]: Screen resolution
- Increase the screen resolution (zoom in)Should remain unchanged on zoom inRTL
- Decrease the screen resolution (zoom out)Should remain unchanged on zoom outRTL
Test 11: Theme changed to Dark ThemeShould reflect theme changeRTL